#ifndef __DBCONNECTION_NFARM_H_
#define __DBCONNECTION_NFARM_H_

#include "Farm.h"
/*
 * demand write and persistance read
 */

class NFarm : public Farm
{
	public:
		NFarm(DbParam dbParameters, const char *writers, const char *readers, bool debug = false); 
		MYSQL *GetReader();
		MYSQL *GetWriter(int idx);
		int GetWriterSize() { return writers_.size(); }
		void CloseConnection(MYSQL *c, bool write = false);
                void Print();
		~NFarm() {}
	protected:
		bool initilize(const char *readers,const char *writers);
		MYSQL *getNextReader(int &num, int size);
		void closeAll();
		vector < DbHost * > writers_ ;
		vector < PDbHost * > readers_;
};

#endif
